import { request } from '@/service/request';

// ---------- Project Begin ----------

/** get project page */
export function fetchGetCjProjectPage(params?: Api.Sampling.ProjectSearchParams) {
  return request<Api.Sampling.ProjectList>({
    url: '/cj_project/page',
    method: 'GET',
    params
  });
}

/** add project info */
export function fetchAddCjProject(data: Api.Sampling.ProjectEdit) {
  return request<boolean>({
    url: '/cj_project/',
    method: 'POST',
    data
  });
}

/** update project info */
export function fetchUpdateCjProject(data: Api.Sampling.ProjectEdit) {
  return request<boolean>({
    url: '/cj_project/',
    method: 'PUT',
    data
  });
}

/** edit delete project */
export function fetchDeleteCjProject(data: Api.Common.DeleteParams) {
  return request<boolean>({
    url: '/cj_project/',
    method: 'DELETE',
    data
  });
}

export function fetchGetCjProjectOptions() {
  return request<CommonType.Option<string>[]>({
    url: '/cj_project/options',
    method: 'GET'
  });
}

export function fetchGetCjProjectProgress(params?: Api.Sampling.CjProject.ProgressSearchParams) {
  return request<Api.Sampling.CjProject.ProgressVO[]>({
    url: '/cj_project/progress',
    method: 'GET',
    params
  });
}
